<!DOCTYPE html>
<html>

{include file='public/header'}
<style>
   .layui-input-block{margin-left: 90px;}
   .layui-table-cell {
        height: auto;
        line-height: 30px;
        text-align: left;
    }
</style>
<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">投放管理</a>
            <a><cite>投放操作日志</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">

        <form class="layui-form layui-row" style="margin-top:15px;margin-bottom: 10px;">
            <div class="layui-inline">
                <label class="layui-form-label w-auto">操作人：</label>
                <div id="responsibility_person_id"></div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label w-auto">公众号：</label>
                <div id="official_account_id"></div>
            </div>
            <div class="layui-inline" id="dataTime">
                <label class="layui-form-label w-auto">日期：</label>
                <div class="layui-inline" id="time" style="display: flex;align-items: center;">
                    <div class="layui-input-inline" style="margin-right:10px">
                        <input type="text" class="layui-input" name="start_date" id="start_time" autocomplete="off" placeholder="开始时间">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="end_date" id="end_time" autocomplete="off" placeholder="结束日期">
                    </div>
                </div>
            </div>
            
            <div class="layui-inline" style="margin-left:10px">
                <button class="layui-btn" lay-submit lay-filter="searchList">搜索</button>
                <button type="reset" id="resetList" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </form>
        <table id="operate_log" lay-filter="operate_log"></table>
    </div>
    <script>
        let totalObj = {}
        let params = {
            elem: '#operate_log'
            , toolbar: true
            , url: '/admin/launch/operateLogList' //数据接口
            , id: 'operate_log'
            , limit:30
            , height:'full-140'
            , cols: [[ //表头
                { field: 'created_at', title: '时间',  width:200, align:'center', templet: function (d) {
                        return dayjsFormat(d.created_at)
                    }
                }
                , { field: 'responsibility_person_name', title: '操作人', align: 'center', width:150 }
                , { field: 'official_account_name', title: '公众号', align: 'center' }
                , { field: 'operate_object', title: '操作对象', align: 'center' }
                , { field: 'operate_action', title: '操作动作', align: 'center' }
                , { field: 'operate_detail_arr', title: '操作结果', align: 'center', templet: function (d) {
                        let texts = '';
                        d.operate_detail_arr.forEach(item=>{
                            texts += item + '<br>'
                        })
                        return texts
                    }
                }
            ]]
        }
        tableList(params)

        let selectParams = {
            url: '/admin/officialAccounts/select?company_id=3',
            selected: [],
            tips: '选择公众号',
            name: 'official_account_id',
            field_id: 'id',
            field_Name: 'name',
            elem: '#official_account_id',
            disabled:false
        }
        selectN(selectParams)

        let selectParamsResponsibilityPerson = {
            url: '/admin/launch/selectOperateList',
            selected: [],
            tips: '选择操作人',
            name: 'responsibility_person_id',
            field_id: 'id',
            field_Name: 'name',
            elem: '#responsibility_person_id',
            disabled:false
        }
        selectN(selectParamsResponsibilityPerson)
        // 日期
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#time',
                range: ['#start_time', '#end_time'],
                format: 'yyyy-MM-dd'
            });
        })
    </script>
</body>

</html>